Checking in minor changes. Now synced with 0.9.0.
authorRaph Levien <raph@src.gnome.org>
Fri, 11 Sep 1998 00:11:05 +0000 (00:11 +0000)
committerRaph Levien <raph@src.gnome.org>
Fri, 11 Sep 1998 00:11:05 +0000 (00:11 +0000)
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gdk/gdkrgb.c
gtk/testrgb.c
tests/testrgb.c

index f4c478ef5bb39c8ee123b907162bede4777d6017..b940e6e226908d58a55022d0ce8a39b98868b729 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Thu Sep 10 17:04:03 1998  Raph Levien  <raph@gimp.org>
+
+       * gtk/testrgb.c (testrgb_rgb_test): Small changes to the test
+       pattern.
+
+       * gdk/gdkrgb.c (gdk_rgb_convert_gray4_pack): Fixed some alignment
+       bugs in the 4bit gray cases.
+
 Wed Sep  9 02:48:44 PDT 1998 Manish Singh <yosh@gimp.org>
 
        * configure.in: added -posix check for NeXTStep
index f4c478ef5bb39c8ee123b907162bede4777d6017..b940e6e226908d58a55022d0ce8a39b98868b729 100644 (file)
@@ -1,3 +1,11 @@
+Thu Sep 10 17:04:03 1998  Raph Levien  <raph@gimp.org>
+
+       * gtk/testrgb.c (testrgb_rgb_test): Small changes to the test
+       pattern.
+
+       * gdk/gdkrgb.c (gdk_rgb_convert_gray4_pack): Fixed some alignment
+       bugs in the 4bit gray cases.
+
 Wed Sep  9 02:48:44 PDT 1998 Manish Singh <yosh@gimp.org>
 
        * configure.in: added -posix check for NeXTStep
index f4c478ef5bb39c8ee123b907162bede4777d6017..b940e6e226908d58a55022d0ce8a39b98868b729 100644 (file)
@@ -1,3 +1,11 @@
+Thu Sep 10 17:04:03 1998  Raph Levien  <raph@gimp.org>
+
+       * gtk/testrgb.c (testrgb_rgb_test): Small changes to the test
+       pattern.
+
+       * gdk/gdkrgb.c (gdk_rgb_convert_gray4_pack): Fixed some alignment
+       bugs in the 4bit gray cases.
+
 Wed Sep  9 02:48:44 PDT 1998 Manish Singh <yosh@gimp.org>
 
        * configure.in: added -posix check for NeXTStep
index f4c478ef5bb39c8ee123b907162bede4777d6017..b940e6e226908d58a55022d0ce8a39b98868b729 100644 (file)
@@ -1,3 +1,11 @@
+Thu Sep 10 17:04:03 1998  Raph Levien  <raph@gimp.org>
+
+       * gtk/testrgb.c (testrgb_rgb_test): Small changes to the test
+       pattern.
+
+       * gdk/gdkrgb.c (gdk_rgb_convert_gray4_pack): Fixed some alignment
+       bugs in the 4bit gray cases.
+
 Wed Sep  9 02:48:44 PDT 1998 Manish Singh <yosh@gimp.org>
 
        * configure.in: added -posix check for NeXTStep
index f4c478ef5bb39c8ee123b907162bede4777d6017..b940e6e226908d58a55022d0ce8a39b98868b729 100644 (file)
@@ -1,3 +1,11 @@
+Thu Sep 10 17:04:03 1998  Raph Levien  <raph@gimp.org>
+
+       * gtk/testrgb.c (testrgb_rgb_test): Small changes to the test
+       pattern.
+
+       * gdk/gdkrgb.c (gdk_rgb_convert_gray4_pack): Fixed some alignment
+       bugs in the 4bit gray cases.
+
 Wed Sep  9 02:48:44 PDT 1998 Manish Singh <yosh@gimp.org>
 
        * configure.in: added -posix check for NeXTStep
index f4c478ef5bb39c8ee123b907162bede4777d6017..b940e6e226908d58a55022d0ce8a39b98868b729 100644 (file)
@@ -1,3 +1,11 @@
+Thu Sep 10 17:04:03 1998  Raph Levien  <raph@gimp.org>
+
+       * gtk/testrgb.c (testrgb_rgb_test): Small changes to the test
+       pattern.
+
+       * gdk/gdkrgb.c (gdk_rgb_convert_gray4_pack): Fixed some alignment
+       bugs in the 4bit gray cases.
+
 Wed Sep  9 02:48:44 PDT 1998 Manish Singh <yosh@gimp.org>
 
        * configure.in: added -posix check for NeXTStep
index f4c478ef5bb39c8ee123b907162bede4777d6017..b940e6e226908d58a55022d0ce8a39b98868b729 100644 (file)
@@ -1,3 +1,11 @@
+Thu Sep 10 17:04:03 1998  Raph Levien  <raph@gimp.org>
+
+       * gtk/testrgb.c (testrgb_rgb_test): Small changes to the test
+       pattern.
+
+       * gdk/gdkrgb.c (gdk_rgb_convert_gray4_pack): Fixed some alignment
+       bugs in the 4bit gray cases.
+
 Wed Sep  9 02:48:44 PDT 1998 Manish Singh <yosh@gimp.org>
 
        * configure.in: added -posix check for NeXTStep
index e91e4c514e0d182202a85268f080d55546497587..46653b6eade24a381374b78587fe8ad603438ee6 100644 (file)
@@ -649,7 +649,13 @@ gdk_rgb_xpixel_from_rgb (guint32 rgb)
 {
   gulong pixel;
 
-  if (image_info->visual->type == GDK_VISUAL_PSEUDO_COLOR)
+  if (image_info->bitmap)
+    {
+      return ((rgb & 0xff0000) >> 16) +
+       ((rgb & 0xff00) >> 7) +
+       (rgb & 0xff) > 510;
+    }
+  else if (image_info->visual->type == GDK_VISUAL_PSEUDO_COLOR)
     pixel = colorcube[((rgb & 0xf00000) >> 12) |
                     ((rgb & 0xf000) >> 8) |
                     ((rgb & 0xf0) >> 4)];
@@ -660,7 +666,8 @@ gdk_rgb_xpixel_from_rgb (guint32 rgb)
                         ((rgb & 0x8000) >> 12) |
                         ((rgb & 0x80) >> 7)];
     }
-  else
+  else if (image_info->visual->type == GDK_VISUAL_TRUE_COLOR ||
+          image_info->visual->type == GDK_VISUAL_DIRECT_COLOR)
     {
 #ifdef VERBOSE
       g_print ("shift, prec: r %d %d g %d %d b %d %d\n",
@@ -682,6 +689,15 @@ gdk_rgb_xpixel_from_rgb (guint32 rgb)
                 (8 - image_info->visual->blue_prec)) <<
                image_info->visual->blue_shift));
     }
+  else if (image_info->visual->type == GDK_VISUAL_STATIC_GRAY ||
+          image_info->visual->type == GDK_VISUAL_GRAYSCALE)
+    {
+      int gray = ((rgb & 0xff0000) >> 16) +
+       ((rgb & 0xff00) >> 7) +
+       (rgb & 0xff);
+
+      return gray >> (10 - image_info->visual->depth);
+    }
 
   return pixel;
 }
@@ -2266,6 +2282,14 @@ gdk_rgb_convert_gray4_pack (GdkImage *image,
          obptr[0] = (pix0 << 4) | pix1;
          obptr++;
        }
+      if (width & 1)
+       {
+         r = *bp2++;
+         g = *bp2++;
+         b = *bp2++;
+         pix0 = (g + ((b + r) >> 1)) >> shift;
+         obptr[0] = (pix0 << 4);
+       }
       bptr += rowstride;
       obuf += bpl;
     }
@@ -2356,6 +2380,16 @@ gdk_rgb_convert_gray4_d_pack (GdkImage *image,
          obptr[0] = (pix0 << 4) | pix1;
          obptr++;
        }
+      if (width & 1)
+       {
+         r = *bp2++;
+         g = *bp2++;
+         b = *bp2++;
+         gray = (g + ((b + r) >> 1)) >> 1;
+         gray += (dmp[(x_align + x + 1) & (DM_WIDTH - 1)] << 2) >> prec;
+         pix0 = (gray - (gray >> prec)) >> right;
+         obptr[0] = (pix0 << 4);
+       }
       bptr += rowstride;
       obuf += bpl;
     }
index 4240d39180d0b03822accb7c35118195a9cce146..d3eec48c08045fb263abb93de671aab562e96fdb 100644 (file)
@@ -137,11 +137,59 @@ testrgb_rgb_test (GtkWidget *drawing_area)
       buf[x * 3 + 1] = cindex & 2 ? 0 : 255;
       buf[x * 3 + 2] = cindex & 1 ? 0 : 255;
     }
-  for (y = 1; y < (HEIGHT * 3) / 4; y++)
+  for (y = 1; y < (HEIGHT * 19) / 32; y++)
     {
       memcpy (buf + y * WIDTH * 3, buf, WIDTH * 3);
     }
-  for (; y < (HEIGHT * 13) / 16; y++)
+  for (; y < (HEIGHT * 20) / 32; y++)
+    {
+      for (x = 0; x < WIDTH; x++)
+       {
+         guchar gray;
+
+         gray = (x * 255) / (WIDTH - 1);
+         buf[y * WIDTH * 3 + x * 3] = gray;
+         buf[y * WIDTH * 3 + x * 3 + 1] = 0;
+         buf[y * WIDTH * 3 + x * 3 + 2] = 0;
+       }
+    }
+  for (; y < (HEIGHT * 21) / 32; y++)
+    {
+      for (x = 0; x < WIDTH; x++)
+       {
+         guchar gray;
+
+         gray = (x * 255) / (WIDTH - 1);
+         buf[y * WIDTH * 3 + x * 3] = 0;
+         buf[y * WIDTH * 3 + x * 3 + 1] = gray;
+         buf[y * WIDTH * 3 + x * 3 + 2] = 0;
+       }
+    }
+  for (; y < (HEIGHT * 22) / 32; y++)
+    {
+      for (x = 0; x < WIDTH; x++)
+       {
+         guchar gray;
+
+         gray = (x * 255) / (WIDTH - 1);
+         buf[y * WIDTH * 3 + x * 3] = 0;
+         buf[y * WIDTH * 3 + x * 3 + 1] = 0;
+         buf[y * WIDTH * 3 + x * 3 + 2] = gray;
+       }
+    }
+  for (; y < (HEIGHT * 24) / 32; y++)
+    {
+      for (x = 0; x < WIDTH; x++)
+       {
+         guchar gray;
+
+         gray = 112 + (x * 31) / (WIDTH - 1);
+         buf[y * WIDTH * 3 + x * 3] = gray;
+         buf[y * WIDTH * 3 + x * 3 + 1] = gray;
+         buf[y * WIDTH * 3 + x * 3 + 2] = gray;
+       }
+    }
+  for (; y < (HEIGHT * 26) / 32; y++)
     {
       for (x = 0; x < WIDTH; x++)
        {
index 4240d39180d0b03822accb7c35118195a9cce146..d3eec48c08045fb263abb93de671aab562e96fdb 100644 (file)
@@ -137,11 +137,59 @@ testrgb_rgb_test (GtkWidget *drawing_area)
       buf[x * 3 + 1] = cindex & 2 ? 0 : 255;
       buf[x * 3 + 2] = cindex & 1 ? 0 : 255;
     }
-  for (y = 1; y < (HEIGHT * 3) / 4; y++)
+  for (y = 1; y < (HEIGHT * 19) / 32; y++)
     {
       memcpy (buf + y * WIDTH * 3, buf, WIDTH * 3);
     }
-  for (; y < (HEIGHT * 13) / 16; y++)
+  for (; y < (HEIGHT * 20) / 32; y++)
+    {
+      for (x = 0; x < WIDTH; x++)
+       {
+         guchar gray;
+
+         gray = (x * 255) / (WIDTH - 1);
+         buf[y * WIDTH * 3 + x * 3] = gray;
+         buf[y * WIDTH * 3 + x * 3 + 1] = 0;
+         buf[y * WIDTH * 3 + x * 3 + 2] = 0;
+       }
+    }
+  for (; y < (HEIGHT * 21) / 32; y++)
+    {
+      for (x = 0; x < WIDTH; x++)
+       {
+         guchar gray;
+
+         gray = (x * 255) / (WIDTH - 1);
+         buf[y * WIDTH * 3 + x * 3] = 0;
+         buf[y * WIDTH * 3 + x * 3 + 1] = gray;
+         buf[y * WIDTH * 3 + x * 3 + 2] = 0;
+       }
+    }
+  for (; y < (HEIGHT * 22) / 32; y++)
+    {
+      for (x = 0; x < WIDTH; x++)
+       {
+         guchar gray;
+
+         gray = (x * 255) / (WIDTH - 1);
+         buf[y * WIDTH * 3 + x * 3] = 0;
+         buf[y * WIDTH * 3 + x * 3 + 1] = 0;
+         buf[y * WIDTH * 3 + x * 3 + 2] = gray;
+       }
+    }
+  for (; y < (HEIGHT * 24) / 32; y++)
+    {
+      for (x = 0; x < WIDTH; x++)
+       {
+         guchar gray;
+
+         gray = 112 + (x * 31) / (WIDTH - 1);
+         buf[y * WIDTH * 3 + x * 3] = gray;
+         buf[y * WIDTH * 3 + x * 3 + 1] = gray;
+         buf[y * WIDTH * 3 + x * 3 + 2] = gray;
+       }
+    }
+  for (; y < (HEIGHT * 26) / 32; y++)
     {
       for (x = 0; x < WIDTH; x++)
        {